package com.sojoys.artifact.config;

import com.sojoys.artifact.constant.ConfigConstant;
import com.sojoys.artifact.factory.bytebuff.IByteBuffFactory;
import com.sojoys.artifact.factory.distributedId.IDistributedIdProviderFactory;
import com.sojoys.artifact.factory.json.IJsonFactory;
import com.sojoys.artifact.factory.message.IMessageFactory;
import com.sojoys.artifact.factory.remote.IRemoteProxyFactory;
import com.sojoys.artifact.factory.session.ISessionFactory;
import com.sojoys.artifact.manager.ByteBuffManager;
import com.sojoys.artifact.manager.DistributedIdManager;
import com.sojoys.artifact.manager.JsonManager;
import com.sojoys.artifact.manager.MessageManager;
import com.sojoys.artifact.manager.PropManager;
import com.sojoys.artifact.manager.RemoteProxyManager;
import com.sojoys.artifact.manager.SessionManager;

public final class Constants {

	/**
	 * 开发模式
	 */
	public boolean isDevMode() {
		return PropManager.getBoolean(ConfigConstant.CONFIG_DEVMODE, false);
	}

	public void setJsonFactory(IJsonFactory factory) {
		JsonManager.me().setFactory(factory);
	}

	public void setByteBuffFactory(IByteBuffFactory factory) {
		ByteBuffManager.me().setFactory(factory);
	}

	public void setRemoteProxyFactory(IRemoteProxyFactory factory) {
		RemoteProxyManager.me().setFactory(factory);
	}

	public void setDistributedIdProviderFactory(IDistributedIdProviderFactory factory) {
		DistributedIdManager.me().setDefaultFactory(factory);
	}

	public void setMessageFactory(IMessageFactory factory) {
		MessageManager.me().setFactory(factory);
	}

	public void setSessionFactory(ISessionFactory factory) {
		SessionManager.me().setFactory(factory);
	}
}
